<div class="slideshow">
    <?php
		if (get_option('wpyou_sliderposts')) { $sliderposts = get_option('wpyou_sliderposts'); } else { $sliderposts = 4; }
			query_posts("caller_get_posts=1&showposts=$sliderposts&meta_key=slider");
	?>
    <?php if (have_posts()) : ?>
        <div id="showimg">
          <?php while (have_posts()) : the_post(); ?>
              <?php if ( get_post_meta($post->ID, 'slider', true) ) { ?>  
				<?php $sliderimg = get_post_meta($post->ID, 'slider', true); ?>
                    <a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><img src="<?php echo $sliderimg; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /> </a>  
            <?php
                 } elseif ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) {
            ?>
                <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" ><img src="<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 768,566 ), false, '' ); echo $image[0];?>" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" /></a>
            <?php } else {?>
                <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" ><img src="<?php echo catch_slider_image(); ?>" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" /></a>
            <?php } ?>
          <?php endwhile;?>
      </div>
      <div class="operate" id="operate">
          <?php $i=1; while (have_posts()) : the_post(); ?>
              <span class="png"><?php echo $i; ?></span>
          <?php $i++; endwhile;?>
      </div>
      <ul id="msg"><li></li></ul>
    <?php else : ?>
        <div id="showimg">
            <a href="#" title="<?php bloginfo('name'); ?>" ><img src="<?php bloginfo('template_url'); ?>/images/no-slider.jpg" title="<?php bloginfo('name'); ?>" alt="<?php bloginfo('name'); ?>" /></a>
        </div>
    <?php endif;?>
</div>
<?php wp_reset_query(); ?>